/**
 * @typedef {Object} Options
 * @property {string | undefined} id
 * @property {number | undefined} width
 * @property {number | undefined} height
 *
 * @description 设置
 * @param {Options | undefined} options
 * @returns {{
 * canvas:HTMLCanvasElement;
 * ctx:CanvasRenderingContext2D
 * }}
 */
function createCanvas(options = {}) {
  const id = options.id ?? "container";
  const width = options.width ?? 390;
  const height = options.height ?? 844;
  /**
   * @type {HTMLCanvasElement | null}
   */
  let canvas = document.createElement("canvas");
  canvas.width = width;
  canvas.height = height;
  canvas.id = id;
  document.body.appendChild(canvas);
  /**
   * @type {CanvasRenderingContext2D}
   */
  const ctx = canvas.getContext("2d");
  return { canvas, ctx };
}
